new Vue({
    el:'#app',
    data:{
        suts:[
            {name:'张三',age:18,sex:'男',sheng:'北京'},
            {name:'李四',age:18,sex:'女',sheng:'日本'},
            {name:'王五',age:18,sex:'男',sheng:'马来西亚'}
        ],
        name:'',age:'',sex:'',sheng:''
    },
    methods:{
        add(){
            if(this.name=='') {alert('姓名不能为空');return false}
            if(this.age=='') {alert('年龄不能为空');return false}
            if(this.sex=='') {alert('性别不能为空');return false}
            let newmsg = {name:this.name,age:this.age,sex:this.sex,sheng:this.sheng};
            this.suts.push(newmsg);
        },
        del(i){
            this.suts.splice(i,1)
        }
    }
})